diff options
author | Andy McFadden <fadden@android.com> | 2010-07-15 17:20:24 -0700 |
---|---|---|
committer | Andy McFadden <fadden@android.com> | 2010-07-19 07:46:46 -0700 |
commit | 1e83b4d026199073c057edcb7836d06ae0716390 (patch) | |
tree | 20c34e463331db9a6e4193eb6abfe4205334bb86 /vm/Native.h | |
parent | 6310c7891b2ffd320db2d9ae674ebe03e233a19e (diff) | |
download | android_dalvik-1e83b4d026199073c057edcb7836d06ae0716390.tar.gz android_dalvik-1e83b4d026199073c057edcb7836d06ae0716390.tar.bz2 android_dalvik-1e83b4d026199073c057edcb7836d06ae0716390.zip |
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
Diffstat (limited to 'vm/Native.h')
-rw-r--r-- | vm/Native.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/vm/Native.h b/vm/Native.h index 2887fbdd4..57396477b 100644 --- a/vm/Native.h +++ b/vm/Native.h @@ -78,6 +78,11 @@ bool dvmLoadNativeCode(const char* fileName, Object* classLoader); void dvmResolveNativeMethod(const u4* args, JValue* pResult, const Method* method, struct Thread* self); +/* + * Unregister all JNI native methods associated with a class. + */ +void dvmUnregisterJNINativeMethods(ClassObject* clazz); + //#define GET_ARG_LONG(_args, _elem) (*(s8*)(&(_args)[_elem])) #define GET_ARG_LONG(_args, _elem) dvmGetArgLong(_args, _elem) |