Implement JNI UnregisterNatives.

This function is of limited use, but one of our partners found a need
for it, so it's finally getting implemented.  It clears all JNI native
method bindings in a given class.

It turns out there are some interesting potential races which can be
avoided by treading lightly.  The utility function that updates the
Method struct has been modified appropriately.

(There's a race on ARM SMP in the original implementation, in which
we could still observe "insns" as NULL after nativeFunc is pointing at
the JNI bridge.  Handled in this change with an explicit full barrier,
which is overkill.  We can make it better as part of the general
barrier-removal pass in bug 2781972 -- really wants an acquiring load
on nativeFunc, though that's a waste for internal native calls.)

Also, stifled an unnecessary warning about redefining a native method
implementation (which is explicitly allowed).  Limited the scope of
an inappropriate "const" declaration.

Bug 2697885.

Change-Id: Ie406e25de3f77d00fe3e9130b406abcb45c3d60e
5 files changed