Barrier after construction of finalizable object

If thread 1 creates an object, and thread 2 executes the finalizer,
then thread 2 must be guaranteed to see a fully-constructed object.
To this end, we need to emit a store/store barrier before returning
from the object's constructor.

We already do this for objects with final fields, so this is a
minor tweak.

While working on this I noticed that Enum overrides finalize()
(for the explicit purpose of making sure that no subclass can do
so), which the VM was taking as a signal that all enumerated types
are finalizable.  In practice this doesn't matter, since the only
instances are the enum elements themselves, and we'd only GC them
if the enum class itself went away.  However, setting it correctly
means less work for dexopt and has no measurable impact on class
loading time.

Bug 3403518

Change-Id: Ifa890b5e7ef1cda2a554ba54f25c4148272c3537
2 files changed