OSDN Git Service

Make Release(JNI_COMMIT) faster
authorAndy McFadden <fadden@android.com>
Wed, 9 Feb 2011 00:24:34 +0000 (16:24 -0800)
committerAndy McFadden <fadden@android.com>
Wed, 9 Feb 2011 00:24:34 +0000 (16:24 -0800)
commit4bdce2f737c33faf6904bff9bc847afaeb124938
treee048a2bbbd83aeb7a21a6cb3a632a2f1d682ddd8
parent1fbcc3ad1344f6997f34db0ab8296b0867c84b71
Make Release(JNI_COMMIT) faster

The Release<primitive>ArrayElements and ReleasePrimitiveArrayCritical
calls take a "mode" argument.  If you pass in JNI_COMMIT, the storage
isn't actually released; instead, the buffer contents are flushed to
the backing storage.  If the VM has handed you a pointer to the raw
data rather than a copy, the call is a no-op.

In its present incarnation, it's a no-op that changes the thread state,
adding overhead and the possibility of suspension.  This change moves
the test for JNI_COMMIT outside the enter/exit macros.

Bug 3430203

Change-Id: I8426647ee02b2336c5c90146028fc207cfbacc3a
vm/Jni.c