Contribute towards native code which override to OpenJDK

Archana Nogriya archana.nogriya at uk.ibm.com
Fri Jan 19 13:07:39 UTC 2018


Hi, 

Why this contribution is required

These changes are to support the override of native C/C++ source by the 
SetupNativeCompilation macro in a similar way to how java classes can be 
overridden in SetupJavaCompilation. This will enable extension/closed 
source providers to easily override native implementations.

Changes were made in:

make/common/NativeCompilation.gmk
diff -r 3a52333a5e57 make/common/NativeCompilation.gmk
--- a/make/common/NativeCompilation.gmk Tue Jan 02 16:35:04 2018 -0500
+++ b/make/common/NativeCompilation.gmk Tue Jan 16 13:42:54 2018 +0000
@@ -511,8 +511,14 @@
       $$(error SRC specified to SetupNativeCompilation $1 contains 
missing directory $$d)))
 
   # Find all files in the source trees. Preserve order.
-  $1_SRCS := $$(foreach s, $$($1_SRC), $$(call CacheFind,$$(s)))
+  $1_SRCS := $$(call uniq, $$(foreach s, $$($1_SRC), $$(call 
CacheFind,$$(s))))
   $1_SRCS := $$(filter $$(NATIVE_SOURCE_EXTENSIONS), $$($1_SRCS))
+  $1_SRCS := $$(strip $$(foreach s, $$($1_SRCS), \
+       $$(eval relative_src := $$(call remove-prefixes, $$($1_SRC), 
$$(s))) \
+    $$(if $$($1_$$(relative_src)), \
+      $$(eval $1_NATIVE_EXCLUDE_FILES += $$(s)), \
+      $$(eval $1_$$(relative_src) := 1) $$(s))))
+  $1_SRCS := $$(filter-out $$($1_NATIVE_EXCLUDE_FILES), $$($1_SRCS))
   # Extract the C/C++ files.
   ifneq ($$($1_EXCLUDE_PATTERNS), )
     # We must not match the exclude pattern against the src root(s).



This new code has been tested by building with latest JDK11. Build has 
been successful. 
Please let me know what is your view on these changes and if we can 
contribute to openJDK. 


Thanks and Regards
Archana Nogriya 
IBM Java Runtime, Open Java Developer
IBM Hursley
Tel: Internal - 247073, External - +44 (0) 1962 81 7073
Office Mobile: 07500095480
Email: archana.nogriya at uk.ibm.com
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU


More information about the build-dev mailing list