You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2009/10/06 11:29:18 UTC
svn commit: r822174 -
/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
Author: hindessm
Date: Tue Oct 6 09:29:17 2009
New Revision: 822174
URL: http://svn.apache.org/viewvc?rev=822174&view=rev
Log:
We shouldn't make JNI calls inside the critical section so we have to
make it smaller. This might be more performant if vect[i].iov_len was
assigned to in a separate loop.
Modified:
harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c?rev=822174&r1=822173&r2=822174&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c Tue Oct 6 09:29:17 2009
@@ -721,7 +721,6 @@
jobject buffer;
jobject* toBeReleasedBuffers;
- jint *cts;
jint *noffset;
jboolean isDirectBuffer = JNI_FALSE;
jint result;
@@ -751,9 +750,8 @@
byteBufferClass = HARMONY_CACHE_GET (env, CLS_java_nio_DirectByteBuffer);
noffset = (*env)->GetIntArrayElements(env, offset, NULL);
- cts = (*env)->GetPrimitiveArrayCritical(env, counts, NULL);
-
for (i = 0; i < length; ++i) {
+ jint *cts;
buffer = (*env)->GetObjectArrayElement(env, buffers, i);
isDirectBuffer = (*env)->IsInstanceOf(env, buffer, byteBufferClass);
if (isDirectBuffer) {
@@ -763,10 +761,11 @@
vect[i].iov_base = (U_8 *)(jbyte *)(IDATA) (*env)->GetByteArrayElements(env, buffer, NULL) + noffset[i];
toBeReleasedBuffers[i] = buffer;
}
+ cts = (*env)->GetPrimitiveArrayCritical(env, counts, NULL);
vect[i].iov_len = cts[i];
+ (*env)->ReleasePrimitiveArrayCritical(env, counts, cts, JNI_ABORT);
}
- (*env)->ReleasePrimitiveArrayCritical(env, counts, cts, JNI_ABORT);
result = writev(SOCKET_CAST (socketP), vect, length);