Previously in JDK-8054720<http://bugs.java.com/view_bug.do?bug_id=8054720>, a number of native methods has been wrapped in order to allow instrumentation. We would like to propose to wrap a number of other methods (available(), skip()) so that we can perform further instrumentation.
I have attached the patch with this email for review. Sunny Chan Executive Director Technology Goldman Sachs (Asia) L.L.C. | 39th Floor | The Center | 99 Queens Road Central | Hong Kong Email: sunny.c...@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<http://www.linkedin.com/company/goldman-sachs/careers> | YouTube<http://www.youtube.com/goldmansachs> | Twitter<http://www.twitter.com/goldmansachs> 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.
# HG changeset patch # User Sunny Chan <sunny.c...@gs.com> # Date 1454040830 18000 # Thu Jan 28 23:13:50 2016 -0500 # Node ID 382aef64e7fca955c3ab4b594b21916fa74df362 # Parent 17ace774163898bd0f86d43b0d604a2eb68f2fe9 XXXXXXX: Further modifications of I/O methods for instrumentation purposes Summary: Wrap further native methods in FileInputStreams diff -r 17ace7741638 -r 382aef64e7fc make/mapfiles/libjava/mapfile-vers --- a/make/mapfiles/libjava/mapfile-vers Mon May 02 15:56:57 2016 +0800 +++ b/make/mapfiles/libjava/mapfile-vers Thu Jan 28 23:13:50 2016 -0500 @@ -76,13 +76,13 @@ Java_java_io_FileDescriptor_initIDs; Java_java_io_FileDescriptor_sync; Java_java_io_FileDescriptor_getAppend; - 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 -r 17ace7741638 -r 382aef64e7fc make/mapfiles/libjava/reorder-sparc --- a/make/mapfiles/libjava/reorder-sparc Mon May 02 15:56:57 2016 +0800 +++ b/make/mapfiles/libjava/reorder-sparc Thu Jan 28 23:13:50 2016 -0500 @@ -44,7 +44,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 -r 17ace7741638 -r 382aef64e7fc make/mapfiles/libjava/reorder-sparcv9 --- a/make/mapfiles/libjava/reorder-sparcv9 Mon May 02 15:56:57 2016 +0800 +++ b/make/mapfiles/libjava/reorder-sparcv9 Thu Jan 28 23:13:50 2016 -0500 @@ -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_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2; text: .text%Java_java_io_UnixFileSystem_list; diff -r 17ace7741638 -r 382aef64e7fc make/mapfiles/libjava/reorder-x86 --- a/make/mapfiles/libjava/reorder-x86 Mon May 02 15:56:57 2016 +0800 +++ b/make/mapfiles/libjava/reorder-x86 Thu Jan 28 23:13:50 2016 -0500 @@ -76,7 +76,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_getStackTraceElements; text: .text%Java_java_lang_System_identityHashCode; diff -r 17ace7741638 -r 382aef64e7fc src/java.base/share/classes/java/io/FileInputStream.java --- a/src/java.base/share/classes/java/io/FileInputStream.java Mon May 02 15:56:57 2016 +0800 +++ b/src/java.base/share/classes/java/io/FileInputStream.java Thu Jan 28 23:13:50 2016 -0500 @@ -279,7 +279,10 @@ * @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 +301,10 @@ * @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 -r 17ace7741638 -r 382aef64e7fc src/java.base/share/native/libjava/FileInputStream.c --- a/src/java.base/share/native/libjava/FileInputStream.c Mon May 02 15:56:57 2016 +0800 +++ b/src/java.base/share/native/libjava/FileInputStream.c Thu Jan 28 23:13:50 2016 -0500 @@ -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) {