8055955: (ch) Remove unnecessary initialization of InetAddress from FileChannel
authorchegar
Tue, 26 Aug 2014 10:19:56 +0100
changeset 26207 a02f6165d5be
parent 26206 fb87c4051d65
child 26208 a581ee8890b1
child 26210 56c6ac1ad45e
8055955: (ch) Remove unnecessary initialization of InetAddress from FileChannel Reviewed-by: alanb
jdk/make/mapfiles/libnio/mapfile-linux
jdk/make/mapfiles/libnio/mapfile-macosx
jdk/make/mapfiles/libnio/mapfile-solaris
jdk/src/java.base/unix/classes/sun/nio/ch/InheritedChannel.java
jdk/src/java.base/unix/native/libnio/ch/IOUtil.c
jdk/src/java.base/unix/native/libnio/ch/InheritedChannel.c
jdk/src/java.base/unix/native/libnio/ch/Net.c
jdk/src/java.base/windows/native/libnio/ch/IOUtil.c
jdk/src/java.base/windows/native/libnio/ch/Net.c
--- a/jdk/make/mapfiles/libnio/mapfile-linux	Tue Aug 26 10:10:58 2014 +0100
+++ b/jdk/make/mapfiles/libnio/mapfile-linux	Tue Aug 26 10:19:56 2014 +0100
@@ -79,6 +79,7 @@
 		Java_sun_nio_ch_InheritedChannel_close0;
 		Java_sun_nio_ch_InheritedChannel_dup;
 		Java_sun_nio_ch_InheritedChannel_dup2;
+		Java_sun_nio_ch_InheritedChannel_initIDs;
 		Java_sun_nio_ch_InheritedChannel_open0;
 		Java_sun_nio_ch_InheritedChannel_peerAddress0;
 		Java_sun_nio_ch_InheritedChannel_peerPort0;
--- a/jdk/make/mapfiles/libnio/mapfile-macosx	Tue Aug 26 10:10:58 2014 +0100
+++ b/jdk/make/mapfiles/libnio/mapfile-macosx	Tue Aug 26 10:19:56 2014 +0100
@@ -62,6 +62,7 @@
 		Java_sun_nio_ch_InheritedChannel_close0;
 		Java_sun_nio_ch_InheritedChannel_dup;
 		Java_sun_nio_ch_InheritedChannel_dup2;
+                Java_sun_nio_ch_InheritedChannel_initIDs;
 		Java_sun_nio_ch_InheritedChannel_open0;
 		Java_sun_nio_ch_InheritedChannel_peerAddress0;
 		Java_sun_nio_ch_InheritedChannel_peerPort0;
--- a/jdk/make/mapfiles/libnio/mapfile-solaris	Tue Aug 26 10:10:58 2014 +0100
+++ b/jdk/make/mapfiles/libnio/mapfile-solaris	Tue Aug 26 10:19:56 2014 +0100
@@ -67,6 +67,7 @@
 		Java_sun_nio_ch_InheritedChannel_close0;
 		Java_sun_nio_ch_InheritedChannel_dup;
 		Java_sun_nio_ch_InheritedChannel_dup2;
+                Java_sun_nio_ch_InheritedChannel_initIDs;
 		Java_sun_nio_ch_InheritedChannel_open0;
 		Java_sun_nio_ch_InheritedChannel_peerAddress0;
 		Java_sun_nio_ch_InheritedChannel_peerPort0;
--- a/jdk/src/java.base/unix/classes/sun/nio/ch/InheritedChannel.java	Tue Aug 26 10:10:58 2014 +0100
+++ b/jdk/src/java.base/unix/classes/sun/nio/ch/InheritedChannel.java	Tue Aug 26 10:19:56 2014 +0100
@@ -226,6 +226,7 @@
 
     // -- Native methods --
 
+    private static native void initIDs();
     private static native int dup(int fd) throws IOException;
     private static native void dup2(int fd, int fd2) throws IOException;
     private static native int open0(String path, int oflag) throws IOException;
@@ -236,5 +237,6 @@
 
     static {
         IOUtil.load();
+        initIDs();
     }
 }
--- a/jdk/src/java.base/unix/native/libnio/ch/IOUtil.c	Tue Aug 26 10:10:58 2014 +0100
+++ b/jdk/src/java.base/unix/native/libnio/ch/IOUtil.c	Tue Aug 26 10:19:56 2014 +0100
@@ -35,7 +35,6 @@
 #include "java_lang_Integer.h"
 #include "nio.h"
 #include "nio_util.h"
-#include "net_util.h"
 
 static jfieldID fd_fdID;        /* for jint 'fd' in java.io.FileDescriptor */
 
@@ -45,7 +44,6 @@
 {
     CHECK_NULL(clazz = (*env)->FindClass(env, "java/io/FileDescriptor"));
     CHECK_NULL(fd_fdID = (*env)->GetFieldID(env, clazz, "fd", "I"));
-    initInetAddressIDs(env);
 }
 
 JNIEXPORT jboolean JNICALL
--- a/jdk/src/java.base/unix/native/libnio/ch/InheritedChannel.c	Tue Aug 26 10:10:58 2014 +0100
+++ b/jdk/src/java.base/unix/native/libnio/ch/InheritedChannel.c	Tue Aug 26 10:19:56 2014 +0100
@@ -47,6 +47,13 @@
     return (family == AF_INET);
 }
 
+JNIEXPORT void JNICALL
+Java_sun_nio_ch_InheritedChannel_initIDs(JNIEnv *env, jclass cla)
+{
+    /* Initialize InetAddress IDs before later use of NET_XXX functions */
+    initInetAddressIDs(env);
+}
+
 JNIEXPORT jobject JNICALL
 Java_sun_nio_ch_InheritedChannel_peerAddress0(JNIEnv *env, jclass cla, jint fd)
 {
--- a/jdk/src/java.base/unix/native/libnio/ch/Net.c	Tue Aug 26 10:10:58 2014 +0100
+++ b/jdk/src/java.base/unix/native/libnio/ch/Net.c	Tue Aug 26 10:19:56 2014 +0100
@@ -151,7 +151,7 @@
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_Net_initIDs(JNIEnv *env, jclass clazz)
 {
-    /* Here because Windows native code does need to init IDs */
+     initInetAddressIDs(env);
 }
 
 JNIEXPORT jboolean JNICALL
--- a/jdk/src/java.base/windows/native/libnio/ch/IOUtil.c	Tue Aug 26 10:10:58 2014 +0100
+++ b/jdk/src/java.base/windows/native/libnio/ch/IOUtil.c	Tue Aug 26 10:19:56 2014 +0100
@@ -56,7 +56,6 @@
     CHECK_NULL(clazz = (*env)->FindClass(env, "java/io/FileDescriptor"));
     CHECK_NULL(fd_fdID = (*env)->GetFieldID(env, clazz, "fd", "I"));
     CHECK_NULL(handle_fdID = (*env)->GetFieldID(env, clazz, "handle", "J"));
-    initInetAddressIDs(env);
 }
 
 /**************************************************************
--- a/jdk/src/java.base/windows/native/libnio/ch/Net.c	Tue Aug 26 10:10:58 2014 +0100
+++ b/jdk/src/java.base/windows/native/libnio/ch/Net.c	Tue Aug 26 10:19:56 2014 +0100
@@ -81,7 +81,7 @@
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_Net_initIDs(JNIEnv *env, jclass clazz)
 {
-    /* nothing to do */
+    initInetAddressIDs(env);
 }
 
 JNIEXPORT jboolean JNICALL