RFA: 8169556: Wrapping of FileInputStream's native skip and available methods

Chan, Sunny Sunny.Chan at gs.com
Tue Mar 14 02:28:43 UTC 2017


Hi Roger, 

Could you commit the change, please?

------------------------------

Message: 3
Date: Fri, 10 Mar 2017 13:58:49 +0000
From: Rob McKenna <rob.mckenna at oracle.com>
To: Roger Riggs <roger.riggs at oracle.com>
Cc: jdk8u-dev at openjdk.java.net
Subject: Re: RFA: 8169556: Wrapping of FileInputStream's native skip
	and available methods
Message-ID: <20170310135849.GA2958 at vimes>
Content-Type: text/plain; charset=us-ascii

Approved

    -Rob

On 10/03/17 08:05, Roger Riggs wrote:
> Hi Sunny,
> 
> yes, the openjdk mail lists filter attachments that don't appear to be text.
> The in-line patch is fine.
> 
> I think we need approval from the jdk8u maintenance lead and a sponsor 
> to commit it (I can volunteer if no one else does).
> 
> Thanks, Roger
> 
> 
> 
> On 3/10/17 2:33 AM, Chan, Sunny wrote:
> >(It seems like the mailing list filtered the attachment so I am going 
> >to inline the patch)
> >
> >Hello,
> >
> >I would like to propose backporting JDK-8169556 to JDK8u-dev. The patch mostly applies cleanly except for the make/mapfiles/libjava/mapfile-vers. As a result I have attached the JDK 8 patch in the email. The patch has been tested with java.io test cases.
> >
> >JBS:
> >https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.openjdk.jav
> >a.net_browse_JDK-2D8169556&d=DgICAg&c=7563p3e2zaQw0AB1wrFVgyagb2IE5rT
> >ZOYPxLxfZlX4&r=e-nMYEAYoRWWms8SM-H97SgyQYsz-xaiLmQPYwZ3m5E&m=g8JC-8bK
> >Y4zCKUW7SdImmGCCn7LBQBLD5Z6pAe598uo&s=ME5fTW83mCNaV65jbt7wnhdfl5uPlZD
> >nWcmhX87_6HQ&e=
> >
> >JDK9 changeset:
> >https://urldefense.proofpoint.com/v2/url?u=http-3A__hg.openjdk.java.n
> >et_jdk9_jdk9_jdk_rev_47a8e055bab1&d=DgICAg&c=7563p3e2zaQw0AB1wrFVgyag
> >b2IE5rTZOYPxLxfZlX4&r=e-nMYEAYoRWWms8SM-H97SgyQYsz-xaiLmQPYwZ3m5E&m=g
> >8JC-8bKY4zCKUW7SdImmGCCn7LBQBLD5Z6pAe598uo&s=jMGzbs0iV9X2klPr2G8s3ufu
> >oywgnWkDK2UCQ92-0cw&e=
> >
> >JDK9 patch review thread:
> >https://urldefense.proofpoint.com/v2/url?u=http-3A__mail.openjdk.java
> >.net_pipermail_core-2Dlibs-2Ddev_2016-2DNovember_044614.html&d=DgICAg
> >&c=7563p3e2zaQw0AB1wrFVgyagb2IE5rTZOYPxLxfZlX4&r=e-nMYEAYoRWWms8SM-H9
> >7SgyQYsz-xaiLmQPYwZ3m5E&m=g8JC-8bKY4zCKUW7SdImmGCCn7LBQBLD5Z6pAe598uo
> >&s=EyVcTSFnFCvGdr5-DyoKZ5oTjcVtvHqVg7euSbMWeE0&e=
> >
> ># HG changeset patch
> ># User Sunny Chan <sunny.chan at gs.com> # Date 1489128533 0
> >#      Fri Mar 10 06:48:53 2017 +0000
> ># Node ID 0d1759fe196541b8d171c63e4cdfca0b6a20031c
> ># Parent  d355fca1b03770f97fc6747ee27d55bb839029a9
> >8169556: Wrapping of FileInputStream's native skip and available 
> >methods
> >Summary: Wrap further native methods in FileInputStreams
> >Contributed-by: sunny.chan at gs.com
> >
> >diff --git a/make/mapfiles/libjava/mapfile-vers 
> >b/make/mapfiles/libjava/mapfile-vers
> >--- a/make/mapfiles/libjava/mapfile-vers
> >+++ b/make/mapfiles/libjava/mapfile-vers
> >@@ -76,13 +76,13 @@
> >                                 Java_java_io_FileDescriptor_initIDs;
> >                                Java_java_io_FileDescriptor_sync;
> >-                              Java_java_io_FileInputStream_available;
> >+                             
> >+ Java_java_io_FileInputStream_available0;
> >                                Java_java_io_FileInputStream_close0;
> >                                Java_java_io_FileInputStream_initIDs;
> >                                Java_java_io_FileInputStream_open0;
> >                                Java_java_io_FileInputStream_read0;
> >                                Java_java_io_FileInputStream_readBytes;
> >-                              Java_java_io_FileInputStream_skip;
> >+                             Java_java_io_FileInputStream_skip0;
> >                                Java_java_io_FileOutputStream_close0;
> >                                Java_java_io_FileOutputStream_initIDs;
> >                                Java_java_io_FileOutputStream_open0;
> >diff --git a/make/mapfiles/libjava/reorder-sparc 
> >b/make/mapfiles/libjava/reorder-sparc
> >--- a/make/mapfiles/libjava/reorder-sparc
> >+++ b/make/mapfiles/libjava/reorder-sparc
> >@@ -48,7 +48,7 @@
> >text: .text%fileOpen;
> >text: .text%Java_java_io_FileInputStream_readBytes;
> >text: .text%readBytes;
> >-text: .text%Java_java_io_FileInputStream_available;
> >+text: .text%Java_java_io_FileInputStream_available0;
> >text: .text%Java_java_io_FileInputStream_close0;
> >text: .text%Java_java_lang_System_mapLibraryName;
> >text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0;
> >diff --git a/make/mapfiles/libjava/reorder-sparcv9 
> >b/make/mapfiles/libjava/reorder-sparcv9
> >--- a/make/mapfiles/libjava/reorder-sparcv9
> >+++ b/make/mapfiles/libjava/reorder-sparcv9
> >@@ -51,7 +51,7 @@
> >text: .text%fileOpen;
> >text: .text%Java_java_io_FileInputStream_readBytes;
> >text: .text%readBytes;
> >-text: .text%Java_java_io_FileInputStream_available;
> >+text: .text%Java_java_io_FileInputStream_available0;
> >text: .text%Java_java_io_FileInputStream_close0;
> >text: .text%Java_java_lang_Compiler_registerNatives;
> >text: 
> >.text%Java_java_security_AccessController_doPrivileged__Ljava_securit
> >y_PrivilegedExceptionAction_2; diff --git 
> >a/make/mapfiles/libjava/reorder-x86 
> >b/make/mapfiles/libjava/reorder-x86
> >--- a/make/mapfiles/libjava/reorder-x86
> >+++ b/make/mapfiles/libjava/reorder-x86
> >@@ -78,7 +78,7 @@
> >text: .text%JNU_GetEnv;
> >text: .text%Java_java_io_UnixFileSystem_checkAccess;
> >text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
> >-text: .text%Java_java_io_FileInputStream_available;
> >+text: .text%Java_java_io_FileInputStream_available0;
> >text: .text%Java_java_lang_reflect_Array_newArray;
> >text: .text%Java_java_lang_Throwable_getStackTraceDepth;
> >text: .text%Java_java_lang_Throwable_getStackTraceElement;
> >diff --git a/src/share/classes/java/io/FileInputStream.java 
> >b/src/share/classes/java/io/FileInputStream.java
> >--- a/src/share/classes/java/io/FileInputStream.java
> >+++ b/src/share/classes/java/io/FileInputStream.java
> >@@ -279,7 +279,11 @@
> >       * @exception  IOException  if n is negative, if the stream does not
> >       *             support seek, or if an I/O error occurs.
> >       */
> >-    public native long skip(long n) throws IOException;
> >+    public long skip(long n) throws IOException {
> >+        return skip0(n);
> >+    }
> >+
> >+    private native long skip0(long n) throws IOException;
> >      /**
> >       * Returns an estimate of the number of remaining bytes that 
> >can be read (or @@ -298,7 +302,11 @@
> >       * @exception  IOException  if this file input stream has been closed by calling
> >       *             {@code close} or an I/O error occurs.
> >       */
> >-    public native int available() throws IOException;
> >+    public int available() throws IOException {
> >+        return available0();
> >+    }
> >+
> >+    private native int available0() throws IOException;
> >      /**
> >       * Closes this file input stream and releases any system 
> >resources diff --git a/src/share/native/java/io/FileInputStream.c 
> >b/src/share/native/java/io/FileInputStream.c
> >--- a/src/share/native/java/io/FileInputStream.c
> >+++ b/src/share/native/java/io/FileInputStream.c
> >@@ -73,7 +73,7 @@
> >}
> >  JNIEXPORT jlong JNICALL
> >-Java_java_io_FileInputStream_skip(JNIEnv *env, jobject this, jlong 
> >toSkip) {
> >+Java_java_io_FileInputStream_skip0(JNIEnv *env, jobject this, jlong 
> >+toSkip) {
> >      jlong cur = jlong_zero;
> >      jlong end = jlong_zero;
> >      FD fd = GET_FD(this, fis_fd);
> >@@ -90,7 +90,7 @@
> >}
> >  JNIEXPORT jint JNICALL
> >-Java_java_io_FileInputStream_available(JNIEnv *env, jobject this) {
> >+Java_java_io_FileInputStream_available0(JNIEnv *env, jobject this) {
> >      jlong ret;
> >      FD fd = GET_FD(this, fis_fd);
> >      if (fd == -1) {
> >
> >
> >Sunny Chan
> >Executive Director
> >Technology
> >
> >Goldman Sachs (Asia) L.L.C. | 39th Floor | The Center | 99 Queens 
> >Road Central | Hong Kong
> >Email:  sunny.chan at gs.com | Tel: +852 2978 6481 | Fax: +852 2978 0633
> >
> >Learn more about Goldman Sachs
> >GS.com<http://www.goldmansachs.com/> | 
> >Blog<http://www.goldmansachs.com/careers/blog/index.html> | 
> >LinkedIn<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.link
> >edin.com_company_goldman-2Dsachs_careers&d=DgICAg&c=7563p3e2zaQw0AB1w
> >rFVgyagb2IE5rTZOYPxLxfZlX4&r=e-nMYEAYoRWWms8SM-H97SgyQYsz-xaiLmQPYwZ3
> >m5E&m=g8JC-8bKY4zCKUW7SdImmGCCn7LBQBLD5Z6pAe598uo&s=BN--VVWrR5Js_oUGC
> >OF-nN-4vy5RsICzBRXHF9gahXs&e= > | 
> >YouTube<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.youtu
> >be.com_goldmansachs&d=DgICAg&c=7563p3e2zaQw0AB1wrFVgyagb2IE5rTZOYPxLx
> >fZlX4&r=e-nMYEAYoRWWms8SM-H97SgyQYsz-xaiLmQPYwZ3m5E&m=g8JC-8bKY4zCKUW
> >7SdImmGCCn7LBQBLD5Z6pAe598uo&s=X5I9ZcWMLNh2AnSwoqLekvzwex4DRdr0LFlBhs
> >qArk0&e= > | 
> >Twitter<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.twitt
> >er.com_goldmansachs&d=DgICAg&c=7563p3e2zaQw0AB1wrFVgyagb2IE5rTZOYPxLx
> >fZlX4&r=e-nMYEAYoRWWms8SM-H97SgyQYsz-xaiLmQPYwZ3m5E&m=g8JC-8bKY4zCKUW
> >7SdImmGCCn7LBQBLD5Z6pAe598uo&s=sTAowGTKigVmr5xAeBtLwZ2_Lbqy-bPcdmlT5r
> >TsF3s&e= >
> >
> >This message may contain information that is confidential or privileged.  If you are not the intended recipient, please advise the sender immediately and delete this message.  See http://www.gs.com/disclaimer/email for further information on confidentiality and the risks inherent in electronic communication.
> >
> 


End of jdk8u-dev Digest, Vol 40, Issue 3
****************************************


More information about the jdk8u-dev mailing list