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 13:41:31 UTC

svn commit: r822224 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c

Author: hindessm
Date: Tue Oct  6 11:41:31 2009
New Revision: 822224

URL: http://svn.apache.org/viewvc?rev=822224&view=rev
Log:
Windows equivalent of commit r822174:

  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/windows/OSNetworkSystemWin32.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c?rev=822224&r1=822223&r2=822224&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c Tue Oct  6 11:41:31 2009
@@ -442,7 +442,6 @@
 
   jobject buffer;
   jobject* toBeReleasedBuffers;
-  jint *cts;
   jint *noffset;
   jboolean isDirectBuffer = JNI_FALSE;
   jint result;
@@ -474,9 +473,8 @@
   byteBufferClass = HARMONY_CACHE_GET (env, CLS_java_nio_DirectByteBuffer);
   noffset = (*env)->GetIntArrayElements(env, offsets, 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) {
@@ -486,10 +484,12 @@
       vect[i].buf = (U_8 *)(jbyte *)(IDATA) (*env)->GetByteArrayElements(env, buffer, NULL) + noffset[i];
       toBeReleasedBuffers[i] = buffer;
     }
+
+    cts = (*env)->GetPrimitiveArrayCritical(env, counts, NULL);
     vect[i].len = cts[i];
-  }
+    (*env)->ReleasePrimitiveArrayCritical(env, counts, cts, JNI_ABORT);
 
-  (*env)->ReleasePrimitiveArrayCritical(env, counts, cts, JNI_ABORT);
+  }
 
   if (socketP->flags & SOCKET_USE_IPV4_MASK)
     {