Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 29167 invoked from network); 6 Oct 2009 09:29:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Oct 2009 09:29:42 -0000 Received: (qmail 73264 invoked by uid 500); 6 Oct 2009 09:29:42 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 73242 invoked by uid 500); 6 Oct 2009 09:29:42 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 72987 invoked by uid 99); 6 Oct 2009 09:29:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Oct 2009 09:29:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Oct 2009 09:29:39 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B28C123888E3; Tue, 6 Oct 2009 09:29:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r822174 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c Date: Tue, 06 Oct 2009 09:29:18 -0000 To: commits@harmony.apache.org From: hindessm@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091006092918.B28C123888E3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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);