Added a barrier to final field updates.

When deserializing an object, code can write to final fields.  The JMM
requires that we give final fields written this way the same treatment
as we would final fields written directly in a constructor.

This adds memory barriers to the two reflection field-set handlers
when the field in question is marked "final".

Also, added a final field update to test 046.

Bug 2965743.

Change-Id: I5ea3cb49e04d932a655740058b847dcb8712e041

Conflicts:
	vm/native/java_lang_reflect_Field.cpp
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

Conflicts:
	vm/analysis/DexPrepare.cpp
	vm/analysis/Optimize.cpp
Stop cheating in reflective field access.

The java.lang.reflect.Field get/set calls have been "cheating" by
reading and writing 32-bit or 64-bit values without regard to the
underlying field type.  This worked fine until recently, when we
developed three special cases:

 (1) writing to a reference field (must notify the GC)
 (2) reading/writing a volatile field (must emit barrier on SMP,
     and 64-bit accesses must be atomic on all platforms)
 (3) writing to a final field (must emit barrier on SMP)

This replaces the old "get a pointer and do stuff" approach with a
bunch of switch statements that call the ObjectInlines functions.

Bug 2992610

Change-Id: Ib30f043d325363743112e9b1bb170d9d232bca6b

Conflicts:
	vm/native/java_lang_reflect_Field.cpp
Use store barrier instead of full barrier.

Make use of ANDROID_MEMBAR_STORE when appropriate.  In mterp, define a
new SMP_DMB_ST macro that will (soon) expand into "dmb st" on ARMv7-A
platforms configured for SMP.

Bug 3003477.

Change-Id: I03c09e93e1374d1c668588c9ad52f5c08d3d2435