On 2014-08-15 10:52, Magnus Ihse Bursie wrote:

*** Issues with source files moving and its repercussions ***

* When the source code has moved, especially the native libraries, most of the specific INCLUDE and EXCLUDE statements are, or should be, unnecessary. Nevertheless, there are still several occasions of such statements. In some cases, it seems like dead code that can (and should) be removed. But in some cases, I believe it is an indication that the source code has still not yet been moved to a suitable location. I believe the end goal with this shuffling regarding native library source code is that there should be a one-to-one correspondance between compiled native library and source code directory. This is now indeed the case for 99% of the libraries, but there are still some exceptions.

This is a slightly vague point at the moment. I indent to check the INCLUDE and EXCLUDE statements more fully and will post a second review with results of what I find. Nevertheless, I think it is important to make sure we do get things correct this time.

Here are the more concrete specification of this, for all files except Awt2dLibraries.gmk, which I'll return to.

In NioLibraries:

* The line "EXCLUDES := sctp" is unnecessary.

In NetworkingLibraries.gmk:

 * There are multiple instances of this pattern:
   ifneq ($(OPENJDK_TARGET_OS), solaris)
     LIBNET_EXCLUDE_FILES += solaris_close.c
   endif
The correct solution is to move the corresponding files away from the "unix" directory and into more specific libraries (linux, solaris and macosx) and include these directories automatically depending on platform. This will allow us to remove the exclude expression.

* For AIX, this is already done (woho!); however, unfortunately, the file aix_close.c ended up not in java.base/aix/native/libnet/ but in java.base/aix/native/libnet/java/net, with remnants of the old
 directory structure still intact.

* Also, the corresponding source line in NetworkingLibraries.gmk for AIX is incorrect, and refers
 to the old structure:
   LIBNET_SRC_DIRS += $(JDK_TOPDIR)/src/aix/native/java/net/ is incorrect.
But if solving the two problems above, this will be corrected all by itself, rendering this statement unnecessary.

In Lib-jdk.security.auth.gmk:

* The file src/jdk.security.auth/unix/native/libjaas/Solaris.c should move to a solaris directory instead, rendering
 the EXCLUDE for libjaas unnecessary.

In Lib-jdk.attach.gmk:

The files
* src/jdk.attach/unix/native/libattach/LinuxVirtualMachine.c
* src/jdk.attach/unix/native/libattach/SolarisVirtualMachine.c
* src/jdk.attach/unix/native/libattach/BsdVirtualMachine.c
should move from unix to linux, solaris and macosx respectively, rendering the EXCLUDES unnecessary.
The statement
  LIBATTACH_EXCLUDE_FILES += AixVirtualMachine.c
is already unnecessary, since that files virtuously is already placed in an aix directory! :-)

In Lib-java.management.gmk:

The files
* src/java.management/unix/native/libmanagement/LinuxOperatingSystem.c
* src/java.management/unix/native/libmanagement/SolarisOperatingSystem.c
* src/java.management/unix/native/libmanagement/MacosxOperatingSystem.c
should move from unix to linux, solaris and macosx respectively, rendering the EXCLUDES unnecessary.

In CoreLibraries.gmk, for libjava:

* The file src/java.base/unix/native/libjava/java_props_macosx.c should move to a macosx directory.
* The line "EXCLUDES := fdlibm/src zip prefs"  is not needed anymore.
* The stanza:
   ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBJAVA_EXCLUDE_FILES += $(JDK_TOPDIR)/src/java.base/unix/native/libjava/HostLocaleProviderAdapter_md.c
   endif
  is unnecessary since no such file exists.

In CoreLibraries.gmk, for libjli:

Here are include statements galore! :) After parsing what we're supposed to do and checking with how the source
code now actually looks, this can boil down to:
* As normal, set the source dirs to share and PLATFORM_OS and OS_API.
* On macosx, exclude java_md_solinux.c, ergo.c and ergo_i586.c.
* On unixes that are not macosx:
If OPENJDK_TARGET_CPU_ARCH != x86 then also exclude ergo_i586.c and set LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO

But to make things worse, we also use a selected subset of the source from zlib :-(, viz.:
      inflate.c inftrees.c inffast.c zadler32.c zcrc32.c zutil.c

This should be turned into a exclude-based statement instead (unless USE_EXTERNAL_LIBZ is true, of course), like this: BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib-1.2.8 (as before) and exclude: compress.c deflate.c gzclose.c gzlib.c gzread.c gzwrite.c infback.c trees.c uncompr.c

/Magnus

Reply via email to